package com.example.springbootdemo.enableautoconfiguration;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

@SpringBootApplication(exclude = CustomAutoConfigurationExclude.class)
public class EnableAutoConfigurationDemo {

    public static void main(String[] args) {
        ConfigurableApplicationContext applicationContext = SpringApplication.run(EnableAutoConfigurationDemo.class, args);

        String test = (String) applicationContext.getBean("test");
        System.out.println(test);
        try {
            String testExclude = (String) applicationContext.getBean("testExclude");
            System.out.println(testExclude);
        } catch (Exception e) {
            System.out.println("testExclude被排除了");
        }
        try {
            String testFilter = (String) applicationContext.getBean("testFilter");
            System.out.println(testFilter);
        } catch (Exception e) {
            System.out.println("testFilter被过滤了");
        }
    }
}
